const express = require('express');
const router = express.Router();
const { emailRegister, emailLogin, wxlogin, logout, getCurrentUser, adminLogin } = require('../controllers/authController');
const { authMiddleware } = require('../middleware/authMiddleware');

// 用户邮箱注册
router.post('/emailregister', emailRegister);
// 用户注册 (统一前端接口)
router.post('/register', emailRegister);
// 用户账号登录
router.post('/emaillogin', emailLogin);
// 微信快捷登录
router.post('/wechatlogin', wxlogin);
// 用户登出
router.post('/logout', authMiddleware, logout);
// 获取当前用户信息
router.get('/user/info', authMiddleware, getCurrentUser);
// 管理员登录
router.post('/admin/login', adminLogin);

module.exports = router;